﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
namespace VPIC_EDIGUI
{
    public partial class MainForm : DevExpress.XtraEditors.XtraForm
    {
        public MainForm()
        {
            InitializeComponent();
            this.LoadData();
        }
        private XtraForm CheckExistChildForm(Type formType)
        {
            foreach (XtraForm f in this.MdiChildren)
            {
                if (f.GetType() == formType)
                    return f;
            }
            return null;
        }
        private void LoadData()
        {
            this.lbUserLoginStatus.Caption = System.Environment.UserName;
            this.lbDateLoginStatus.Caption = DateTime.Now.ToLongDateString();
            

        }

        private void btnEDIProcess_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            XtraForm frm = this.CheckExistChildForm(typeof(EDIProcess));
            if (frm != null)
                frm.Activate();
            else
            {
                EDIProcess frm1 = new EDIProcess();
                frm1.MdiParent = this;
                frm1.Show();
            }
        }

        private void btnSettings_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
    


            XtraForm frm = this.CheckExistChildForm(typeof(Settings));
            if (frm != null)
                frm.Activate();
            else
            {
                Settings frm1 = new Settings();
                frm1.MdiParent = this;
                frm1.Show();
            }
        }
    }
}
